package optimizers.tools;

import java.util.Calendar;

//author: nicolas.bredeche(at)isir.upmc.fr
//created 2013-2-8

public class Misc {

	static public String getCurrentTimeAsCompactString ()
	{
		String string = new String();

		Calendar now = Calendar.getInstance();
				
		int year = now.get(Calendar.YEAR);
        int month = now.get(Calendar.MONTH) + 1; 
        int day = now.get(Calendar.DAY_OF_MONTH); 
        int hour = now.get(Calendar.HOUR_OF_DAY);  
        int minute = now.get(Calendar.MINUTE);
        int second = now.get(Calendar.SECOND);
        
        string = ""+year;
        if ( month < 10 ) string += "0";
        string += month;
        if ( day < 10 ) string += "0";
        string += day;
        string += "_";
        if ( hour < 10 ) string += "0";
        string += hour+"h";
        if ( minute < 10 ) string += "0";
        string += minute+"m";
        if ( second < 10 ) string += "0";
        string += second+"s";
        
        return string;
	}

}
